<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/15 0015
 * Time: 下午 7:51
 */
namespace app\common\model;

use think\Model;

class Groupproduct extends Model{
    protected $autoWriteTimestamp = true;
    public function product(){
        return $this->hasOne('Product','id','productId');

    }

    /**
     * @param $data
     * @return array|false|\PDOStatement|string|Model
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * 获取团购商平信息
     */
    public function findGroupProduct($data){
        return self::where(
            [
                "storeId"=>$data['storeId'],
                "productId"=>$data['prodcutId']
            ]
        )->find();
    }


}